<?php
use \yii\helpers\Url;
use \common\components\Toast;

$this->title = '权限列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="portlet-body">
    <div class="table-toolbar">
        <div class="row">
            <div class="col-md-6">
                <div class="btn-group">
                        <a data-url="<?=Url::to(['/auth/permission'])?>" data-toggle="modal" class="btn sbold green modal-btn"> 添加权限
                            <i class="fa fa-plus"></i>
                        </a>
                </div>
            </div>
            <div class="col-md-6">
            </div>
        </div>
    </div>

    <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
        <thead>
        <tr>
            <th> 权限 </th>
            <th> 权限描述 </th>
            <th> 操作 </th>
        </tr>
        </thead>
        <tbody>
        <?php foreach($permissions as $v){?>
            <tr>
                <td><?=$v->name?></td>
                <td>
                    <?=$v->description?>
                </td>
                <td>
                    <a href="<?=Url::to(['/auth/delete','action'=>'permission','name'=>$v->name])?>" class="btn btn-xs default btn-delete"><i class="glyphicon glyphicon-trash"></i> <span>删除</span></a>
                </td>
            </tr>
        <?php }?>
        </tbody>
    </table>
</div>
<div id="ajax-modal" class="modal fade" tabindex="-1"> </div>
<?=
    Toast::widget();
    $this->registerJsFile('/static/pages/js/list.js', [ 'depends' => 'backend\assets\AppAsset']);
    $this->registerJsFile('/static/pages/js/auth.js', [ 'depends' => 'backend\assets\AppAsset']);
?>